﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Modbus.Utility;

namespace ModbusTestTool
{
    class Uword : BaseRegisterGeneric <ushort>
    {
        /// <summary>
        /// The actual internal value
        /// </summary>
        


        public Uword(string inParamName, int inRegister)
            : base(inParamName, inRegister)
        {
        }

        public override void getValue(ushort[] word)
        {
            word[baseRegister] = m_result;
        }
        

        public override int size { get { return 1; } }

        /// <summary>
        /// Pass in an array which represent a modbus range exampe 40000-49999 the function will extract value from array
        /// </summary>
        /// <param name="dataStore"></param>
        public override void setValue(ushort[] dataStore)
        {
            lock (lockVariable)
            {
                m_result = dataStore[baseRegister];
                NotifyPropertyChanged("value");
            }
        }


    }
}
